package cn.orangeframe.neon.domain.adapter;

import cn.orangeframe.neon.domain.entity.WorkflowDef;
import cn.orangeframe.neon.domain.entity.GraphData;

import java.util.List;

public interface MetadataAdapter {
    /**
     * Get all workflow definitions
     * @return
     */
    List<WorkflowDef> getAllWorkflowDef();

    /**
     * Get workflow definition by name and version
     * @param name
     * @param version
     * @return
     */
    WorkflowDef getWorkflowDef(String name, int version);

    /**
     * Get latest version of workflow definition by name
     * @param name
     * @return
     */
    Integer getLatestVersion(String name);

    /**
     * Update workflow definition
     * @param def
     * @param latestVersion
     * @param json_data
     * @return
     */
    Integer updateWorkflowDef(WorkflowDef def, int latestVersion, String json_data);

    /**
     * Register workflow definition
     * @param def
     * @param latestVersion
     * @param json_data
     * @return
     */
    Integer registerWorkflowDef(WorkflowDef def, int latestVersion, String json_data);

    /**
     * Get all graph workflow definitions
     * @param name
     * @param version
     * @return
     */
    GraphData getGraphWorkflowDef(String name, int version);

    /**
     * Get all graph workflow definitions
     * @param name
     * @return
     */
    Integer getGraphLatestVersion(String name);

    /**
     * Register graph workflow definition
     * @param def
     * @param latestVersion
     * @param json_data
     * @return
     */
    Integer registerGraphWorkflowDef(GraphData def, int latestVersion, String json_data);

    /**
     * Update graph workflow definition
     * @param def
     * @param latestVersion
     * @param json_data
     * @return
     */
    Integer updateGraphWorkflowDef(GraphData def, int latestVersion, String json_data);

}
